home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_sol_bluegem.cog < prev    next >
Text File  |  1999-11-15  |  11KB  |  412 lines

  1. # Jones 3D Cog Script
  2. #
  3. # SOL_BlueGem.cog
  4. #
  5. # [TRM]
  6. #
  7. # Blue = GemB bin 96
  8. #
  9. # (C) 1999 LucasArts Entertainment Company LLC. All Rights Reserved
  10. # ========================================================================================
  11.  
  12. symbols
  13.  
  14.     message     startup
  15.     message     user0
  16.     message     activated
  17.     message     touched
  18.     message     arrived
  19.     message     sighted
  20.     message     damaged
  21.     message     pulse
  22.     
  23.     thing       player      local
  24.     thing       deadIndy    local
  25.     thing       gem_Item    local
  26.     thing       gem2        local
  27.     thing       torch0
  28.     thing       torch1
  29.     thing       flame0
  30.     thing       flame1
  31.     
  32.     thing       gem             mask=0x408
  33.     thing       t_WhipMe        mask=0x408
  34.     thing       trapDoor
  35.     thing       spikes
  36.     
  37.     thing       interpCam
  38.     
  39.     surface     surf0
  40.     surface     surf1
  41.     surface     surf2
  42.     
  43.     surface     surf_Gem1       mask=0x408
  44.     surface     surf_Gem2       mask=0x408
  45.     surface     surf_Gem3       mask=0x408
  46.     
  47.     sector      lookAtMe
  48.     sector      sec_trapTrig
  49.     
  50.     sound       burning=gen_torch_burnin_c.wav          local
  51.     sound       lite=gen_torchlitet_c.wav               local
  52.     sound       sndDie=tem_temspikes_up_kill_c.wav      local
  53.     
  54.     sound       say_whistle=Inxj006.wav                 local   # whistle
  55.     sound       say_NowWhat=Inxj012.wav                 local   # Now what!
  56.     sound       say_Ugh=inxj018a.wav                    local
  57.     
  58.     sound       sfx_Trap1=pru_trapblock_stuck_c.wav     local
  59.     sound       sfx_Trap2=tem_temspikes_activate_c.wav  local
  60.     
  61.     sound       snd_Gem1=Inxj193.wav    local   # First gem: One of King Sol's jewels.
  62.     sound       snd_Gem2=Inxj194.wav    local   # Second gem: Another Jewel...
  63.     sound       snd_Gem3=Inxj195.wav    local   # Third gem: A third gem...
  64.     
  65.     template    tpl_Indy=indy_sh_actor          local
  66.     template    tpl_Item=gemb                   local   # blue gem item
  67.     template    tpl_Gem=gembmove                local   # blue gem move
  68.  
  69.     keyframe    inDie=in_die_buckle.key         local
  70.     
  71.     cog         redGem
  72.     cog         greenGem
  73.     cog         hintCog
  74.     cog         talkCog         local
  75.     
  76.     flex        flickertime=2.0
  77.     flex        lituptime=0.5
  78.     flex        maxradius=0.15
  79.     flex        minradius=0.15
  80.     
  81.     vector      minlite         local
  82.     vector      maxlite         local
  83.     vector      zerolite        local
  84.     
  85.     vector      posOffset       local
  86.     vector      angOffset       local
  87.     vector      dir             local
  88.     
  89.     int         lit=0           local
  90.     int         vibe            local
  91.     int         curFrame        local
  92.     int         once=1          local
  93.     int         gemsFound=0     local
  94.     int         deadMan=0       local
  95.     int         victim          local
  96.     int         whipped=0       local
  97.     int         dif_Level       local
  98.     
  99.     # ** subroutines **
  100.     flex        pickupGem       local
  101.     
  102. end
  103.  
  104. # ========================================================================================
  105.  
  106. code
  107.  
  108. startup:
  109.     
  110.     player = GetLocalPlayerThing();
  111.     
  112.     minlite = VectorSet(0.87, 0.55, 0.06);
  113.     maxlite = VectorSet(0.89, 0.64, 0.30);
  114.     zerolite = VectorSet(0.25, 0.25, 0.0);
  115.     
  116.     SetThingFlags(flame0, 0x10);
  117.     SetThingFlags(flame1, 0x10);
  118.     SetThingLight(torch0, zerolite, maxradius, 0.1);
  119.     SetThingLight(torch1, zerolite, maxradius, 0.1);
  120.     
  121.     SetThingLight(trapDoor, '0.50 0.50 0.25', 0.001, 0.1);
  122.     SetThingLight(spikes, '0.50 0.50 0.25', 0.001, 0.1);
  123.     SetThingLight(gem, '0.3 0.3 0.8', 0.001, 0.1);
  124.     
  125.     return;
  126.  
  127. # ========================================================================================
  128.  
  129. user0:
  130.  
  131.     gemsFound = gemsFound + 1;
  132.     return;
  133.     
  134. # ========================================================================================
  135.  
  136. activated:
  137.  
  138.     if(lit == 1) return;
  139.     
  140.     if((GetSenderRef() == t_WhipMe) && (whipped == 0))
  141.     {
  142.         lit = 1;
  143.         Call pickupGem;
  144.     }
  145.     
  146.     else if((GetSenderRef() == gem) || (GetSenderRef() == gem2))
  147.     {
  148.         Print("picking up gem");
  149.         lit = 1;
  150.         Call pickupGem;
  151.     }
  152.     
  153.     return;
  154.         
  155. # ========================================================================================
  156.  
  157. pickupGem:
  158.  
  159.     # increase gemsfound in the other cogs
  160.     SendMessage(redGem, user0);
  161.     SendMessage(greenGem, user0);
  162.     
  163.     # solve hint21
  164.     SendMessage(hintCog, user0);
  165.     
  166.     dif_Level = GetDifficulty();
  167.     
  168.     # do cutscene stuff
  169.     MakeMeStop();
  170.     
  171.     # offset camera
  172.     if(whipped == 0) SetExtCamOffsetToThing(interpCam);
  173.     
  174.     # put away any weapon
  175.     DeselectWeaponWait(player);
  176.     
  177.     # pick up the gem
  178.     if(whipped == 0) PlayMode(player, 60, 0);
  179.     else PlayMode(player, 24, 0);
  180.     
  181.     # Call the Pickup Lines cog
  182.     talkCog = GetCogByIndex(0);
  183.     SendMessage(talkCog, 27);
  184.     
  185.     # rest and then destroy gem
  186.     Sleep(0.3);
  187.     
  188.     if(whipped == 0) DestroyThing(gem);
  189.     else DestroyThing(gem2);
  190.     
  191.     # add gemb to inventory
  192.     SetInvAvailable(player, 96, 1);
  193.     ChangeInv(player, 96, 1.0);
  194.     JonesInvItemChanged(96);
  195.     
  196.     # sleep for a bit to wait for talkCog
  197.     Sleep(1.0);
  198.     
  199.     # play dialog as gems spins into inventory
  200.     if(gemsFound == 0)
  201.     {
  202.         PlayVoice(player, snd_Gem1, 1.0, 1);
  203.     }
  204.     
  205.     else if(gemsFound == 1)
  206.     {
  207.         PlayVoice(player, snd_Gem2, 1.0, 1);
  208.     }
  209.     
  210.     else if(gemsFound == 2)
  211.     {
  212.         PlayVoice(player, snd_Gem3, 1.0, 1);
  213.     }
  214.     
  215.     # increase gemsfound in this cog
  216.     gemsFound = gemsFound + 1;
  217.     
  218.     # return control to player
  219.     ClearActorFlags(player, 0x200000);
  220.     RestoreExtCam();
  221.     
  222.     Sleep(0.25);
  223.     
  224.     # shake the place
  225.     SetPulse(0.01);
  226.     
  227.     # light the torches
  228.     ClearThingFlags(flame0, 0x10);
  229.     ClearThingFlags(flame1, 0x10);
  230.     PlaySoundThing(lite, torch0, 1.0, 5, 15, 0x0);                                 
  231.     PlaySoundThing(lite, torch1, 1.0, 5, 15, 0x0);
  232.     SetThingLight(torch0, minlite, maxradius, lituptime);                           
  233.     SetThingLight(torch1, minlite, maxradius, lituptime);
  234.     
  235.     PlaySoundThing(burning, torch0, 1.0, 5, 15, 0x1);
  236.     PlaySoundThing(burning, torch1, 1.0, 5, 15, 0x1);
  237.     
  238.     Sleep(0.5);
  239.     
  240.     # move door down slightly to alert player
  241.     SetAdjoinFlags(surf0, 2);     # move
  242.     SetAdjoinFlags(surf1, 2);
  243.     DetachThing(player);
  244.     MoveToFrame(trapDoor, 1, 2.0);
  245.     PlaySoundLocal(sfx_Trap1, 1.0, 0.0, 0x0, 0);
  246.     
  247.     Sleep(0.01);
  248.     ClearAdjoinFlags(surf2, 2);     # no move
  249.     
  250.     # say "now what!"
  251.     if(whipped == 0) PlayVoice(player, say_NowWhat, 1.0, 1);
  252.     
  253.     curFrame = 1;
  254.     
  255.     SetPulse(0.0);
  256.     
  257.     if(whipped == 0)
  258.     {
  259.         if(dif_Level < 3)
  260.         {
  261.             Sleep(2.5);
  262.         }
  263.         
  264.         else if(dif_Level == 3)
  265.         {
  266.             Sleep(1.0);
  267.         }
  268.     }
  269.     
  270.     Sleep(0.5);
  271.     
  272.     # lower trap door all the way
  273.     SetAdjoinFlags(surf2, 2);     # move
  274.     DetachThing(player);
  275.     MoveToFrame(trapDoor, 2, 8.0);
  276.     PlaySoundLocal(sfx_Trap2, 1.0, 0.0, 0x0, 0);
  277.     
  278.     return;
  279.     
  280. # ========================================================================================
  281.  
  282. touched:
  283.  
  284.     if((GetSenderRef() == spikes) && (deadMan == 0) && (GetThingHealth(player) > 0))
  285.     {
  286.         Print("I'm squishing your head");
  287.         deadMan = 1;
  288.         
  289.         SetCollideType(spikes, 0);
  290.         DamageThing(player, 1000.0, 0x1, victim);
  291.         Sleep(0.1);
  292.         
  293.         PlaySoundLocal(sndDie, 1.0, 0.0, 0x0, 0);
  294.         PlaySoundLocal(say_Ugh, 1.0, 0.0, 0x0, 0);
  295.                             
  296.         # hide player
  297.         SetThingFlags(player, 0x80000);
  298.         
  299.         # create actor indy
  300.         deadIndy = CreateThing(tpl_Indy, player);
  301.         CaptureThing(deadIndy);
  302.                             
  303.         # Show actor Indy and play Keyframe
  304.         ClearThingFlags(deadIndy, 0x80000);
  305.         PlayKey(deadIndy, inDie, 4, 0x14, 0);
  306.     }
  307.  
  308.     return;
  309.     
  310. # ========================================================================================
  311.  
  312. arrived:
  313.  
  314.     if(curFrame == 1)
  315.     {
  316.         Print("arrived");
  317.         SetThingLight(trapDoor, '0.0 0.0 0.0', 0.0, 0.01);
  318.         curFrame = 2;
  319.         
  320.         UpdateDifficulty(dif_Level);
  321.         
  322.         Sleep(2.0);
  323.         
  324.         # if he's still alive, prepare sector for whistle
  325.         if(GetThingHealth(player) > 0)
  326.         {
  327.             ClearSectorFlags(lookAtMe, 0x4000);
  328.             once = 0;
  329.         }
  330.     }
  331.     
  332.     return;
  333.     
  334. # ========================================================================================
  335.  
  336. sighted:
  337.  
  338.     if((GetSenderRef() == lookAtMe) && (once == 0) && (deadMan == 0))
  339.     {
  340.         once = 1;
  341.         PlayVoice(player, say_Whistle, 1.0, 1);
  342.     }
  343.  
  344.     return;
  345.     
  346. # ========================================================================================
  347.  
  348. damaged:
  349.  
  350.     Print("damaged");
  351.     
  352.     if((GetParam(1) != 0x10) || (whipped == 1)) return;
  353.     
  354.     whipped = 1;
  355.         
  356.     # create item gem for whipping
  357.     gem_Item = CreateThing(tpl_Item, gem);
  358.     CaptureThing(gem_Item);
  359.     DestroyThing(gem);
  360.     gem = -1;
  361.  
  362.     dir = VectorAdd(GetThingPos(player), '0.0 0.0 0.3');
  363.     dir = VectorScale(VectorSub(dir, GetThingPos(gem_Item)), 0.13);
  364.     ApplyForce(gem_Item, dir);
  365.     
  366.     Sleep(1.0);
  367.     
  368.     # create a move gem
  369.     gem2 = CreateThing(tpl_Gem, gem_Item);
  370.     CaptureThing(gem2);
  371.     DestroyThing(gem_Item);
  372.     
  373.     Print("hi");
  374.  
  375.     return;
  376.  
  377. # ========================================================================================
  378.  
  379. pulse:
  380.     
  381.     # shake the camera
  382.     vibe = RandBetween(1, 4);
  383.     if (vibe == 1)
  384.     {
  385.         posOffset = '-0.005 0.00 -0.002';
  386.         angOffset = '0.00 -0.002 0.002';
  387.     }
  388.     if (vibe == 2)
  389.     {
  390.         posOffset = '0.005 -0.005 0.002';
  391.         angOffset = '0.002 0.00 -0.002';
  392.     }
  393.     if (vibe == 3)
  394.     {
  395.         posOffset = '0.002 0.005 -0.005';
  396.         angOffset = '-0.002 0.002 -0.002';
  397.     }
  398.     if (vibe == 4)
  399.     {
  400.         posOffset = '-0.002 0.00 0.005';
  401.         angOffset = '0.00 0.00 0.002';
  402.     }
  403.  
  404.     SetPOVShake(posOffSet, angOffSet, 200.0, 200.0);
  405.  
  406.     return;
  407.         
  408. # ========================================================================================
  409.         
  410. end
  411.  
  412.